using System;
using System.Collections.Generic;
using System.Text;
using Sandia.MVCFramework.Request;

namespace Sandia.MVCFramework.Request
{
    /// <summary>
    /// Simple generic to simplify the creation of new parameters.
    /// </summary>
    /// <remarks>
    /// Simplifies the creation of parameter classes.  Note that the Request
    /// classes use the parameter name as the identifier in its dictionary.
    /// This classes returns the type of the paramater as the name.  
    /// </remarks>
    /// <typeparam name="T">The object to be used in the parameter</typeparam>
    public class ObjectParameter<T>: AbstractStandardRequestParameter
    {
        /// <summary>
        /// Create a new parameter
        /// </summary>
        /// <param name="parameter"></param>
        public ObjectParameter(T parameter)
        {
            this.Data = parameter;
        }

        /// <summary>
        /// The object to be stored.
        /// </summary>
        public T Object
        {
            get { return (T)Data; }
            set { Data = value; }
        }

        /// <summary>
        /// The name of this parameter
        /// </summary>
        /// <returns>The fully qualified type name of the class being stored in this parameter</returns>
        protected override string initName()
        {
            return typeof(T).FullName;
        }
    }
}
